/*
 * @Description:
 * @Author: fhw
 * @Date: 2022-08-08 16:13:12
 */
import { ApiProperty, ApiPropertyOptional } from '@nestjs/swagger'
import { IsEnum, IsNotEmpty } from 'class-validator'
import { FindOperator } from 'typeorm'
export class GetUserFriendsListDto {
  public createDate?: FindOperator<string>

  @IsNotEmpty({ message: '用户id不能为空' })
  @ApiProperty({
    type: Number,
    name: 'userId',
    description: '用户id',
  })
  public readonly userId: number

  @ApiPropertyOptional({
    type: Number,
    name: 'friendsId',
    description: '好友id',
  })
  public readonly friendsId?: number

  @ApiPropertyOptional({
    type: String,
    name: 'del',
    description: '删除朋友验证消息，0：删除，1：未删除',
  })
  public readonly del?: string

  @ApiPropertyOptional({
    type: Number,
    name: 'status',
    description: '验证状态  0:待通过，1：通过，2：拒绝好友，删除数据',
    enum: [0, 1, 2],
    example: 2,
  })
  public readonly status?: number

  @ApiPropertyOptional({
    type: String,
    name: 'createTimeStart',
    description: '创建开始时间',
  })
  public readonly createTimeStart?: string
  @ApiPropertyOptional({
    type: String,
    name: 'createTimeEnd',
    description: '创建结束时间',
  })
  public readonly createTimeEnd?: string
}
export class AddChatUserFriendsDto {
  @IsNotEmpty({ message: '好友id不能为空' })
  @ApiProperty({
    type: Number,
    name: 'friendsId',
    description: '好友id',
  })
  public readonly friendsId: number

  @IsNotEmpty({ message: '用户id不能为空' })
  @ApiProperty({
    type: Number,
    name: 'userId',
    description: '用户id',
  })
  public readonly userId: number

  @IsNotEmpty({ message: '验证消息不能为空' })
  @ApiProperty({
    type: String,
    name: 'verification',
    description: '验证消息',
  })
  public readonly verification: string
}

export class ApplyForVerificationDto {
  @IsNotEmpty({ message: '好友id不能为空' })
  @ApiProperty({
    type: Number,
    name: 'friendsId',
    description: '好友id',
  })
  public readonly friendsId: number

  @IsNotEmpty({ message: '用户id不能为空' })
  @ApiProperty({
    type: Number,
    name: 'userId',
    description: '用户id',
  })
  public readonly userId: number

  @IsNotEmpty({ message: '消息id不能为空' })
  @ApiProperty({
    type: Number,
    name: 'id',
    description: 'id',
  })
  public readonly id: number

  @IsEnum([1, 2], { message: '验证状态错误' }) //枚举
  @IsNotEmpty({ message: '验证状态不能为空' })
  @ApiProperty({
    type: Number,
    name: 'status',
    description: '验证状态  0:待通过，1：通过，2：拒绝好友，删除数据',
    enum: [1, 2],
    example: 2,
  })
  public readonly status: number
}

export class DelChatUserFriendsDto {
  @IsNotEmpty({ message: '好友id不能为空' })
  @ApiProperty({
    type: Number,
    name: 'friendsId',
    description: '好友id',
  })
  public readonly friendsId: number

  @IsNotEmpty({ message: '用户id不能为空' })
  @ApiProperty({
    type: Number,
    name: 'userId',
    description: '用户id',
  })
  public readonly userId: number
  @ApiPropertyOptional({
    type: Number,
    name: 'status',
    description: '状态',
  })
  public readonly status?: number
}

export class UpdateFriendsLatestNewsDto extends DelChatUserFriendsDto {
  @IsNotEmpty({ message: '消息ID不能为空' })
  @ApiProperty({
    type: String,
    name: 'latestNews',
    description: '消息ID不能为空',
  })
  public readonly latestNews: string
}
export class UpdateRemarksDto extends DelChatUserFriendsDto {
  @IsNotEmpty({ message: '备注' })
  @ApiProperty({
    type: String,
    name: 'remarks',
    description: '备注',
  })
  public readonly remarks: string
}
export class DeleteFriendsVerificationDto {
  @IsNotEmpty({ message: '好友id不能为空' })
  @ApiProperty({
    type: Number,
    name: 'friendsId',
    description: '好友id',
  })
  public readonly friendsId: number

  @IsNotEmpty({ message: '用户id不能为空' })
  @ApiProperty({
    type: Number,
    name: 'userId',
    description: '用户id',
  })
  public readonly userId: number
}